<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    <script src="../vuejs/vue.js"></script>
    <template id="my-app">
        您的问题<input type="text" v-model="question">
        <h2>{{anwer}}</h2>
    </template>
    <script>
        Vue.createApp({
            template:`#my-app`,
            data(){
                return{
                    counter:0,
                    question:'Hello Word',
                    anwer:''
                }
            },
            watch:{
                //question侦听的data的属性的名称
                //newValue是变化后的新值
                //oldValue是变化前的旧值
                question(newValue,oldValue){
                    this.anwer='旧值：'+oldValue+'新值：'+newValue
                }
            }

        }).mount('#app')
    </script>
</body>
</html>